package 多线程初阶.线程的创建方式;

import static java.lang.Thread.sleep;

public class Demo5 {
    public static void main(String[] args) {
        Thread thread=new Thread(()->{
            while (true){
                System.out.println("thread is run");
                try {
                    sleep(1000);
                } catch ( InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        thread.start();
        while (true){
            System.out.println("main is run");
            try {
                sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
